# models.py

from django.db import models

class BayInformation(models.Model):
    bay_id = models.AutoField(primary_key=True, verbose_name='胎位ID')
    first_level_area = models.CharField(max_length=100, verbose_name='一级区域')
    second_level_area = models.CharField(max_length=100, verbose_name='二级区域')
    bay_number = models.CharField(max_length=50, verbose_name='胎位编号')
    bay_description = models.TextField(null=True, blank=True, verbose_name='胎位描述')
    dimension = models.CharField(max_length=100, null=True, blank=True, verbose_name='尺寸描述')
    lifting_capacity = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True, verbose_name='最大起重能力(t)')
    height_limit = models.DecimalField(max_digits=10, decimal_places=2, null=True, blank=True, verbose_name='高度限制(m)')
    labor_team = models.CharField(max_length=100, null=True, blank=True, verbose_name='劳务队')
    designated_segment = models.CharField(max_length=50, null=True, blank=True, verbose_name='指定分段号')
    segment_type = models.CharField(max_length=100, null=True, blank=True, verbose_name='分段类型')
    attribute = models.CharField(max_length=255, null=True, blank=True, verbose_name='其他属性')

    def __str__(self):
        return f"{self.bay_number} - {self.first_level_area}/{self.second_level_area}"

    class Meta:
        db_table = 'bay_information'
        verbose_name = '胎位信息'
        verbose_name_plural = '胎位信息列表'